<template>
  <div class="hello">
    <span>
      我是子组件,我想修改父组件的title:
    </span>
    <h3>{{ msg1 }}</h3>
    <button @click="changeFu">修改</button>
    <h3>{{ msg2 }}</h3>
  </div>
</template>

<script>
export default {
  name: 'HelloWorld',
  props: {
    msg1: String
  },
  data() {
    return {
      msg2: '父组件的title被我修改了'
    }
  },
  methods: {
    changeFu() {
      this.$emit('changeTitle', this.msg2);
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>

.hello {
  color: red;
  border: 1px solid #000;
}
</style>
